<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:composite="http://java.sun.com/jsf/composite"
	xmlns:common="http://java.sun.com/jsf/composite/common">

<composite:interface>
	<composite:attribute name="pedido" />
	<composite:attribute name="parentId" />
	<composite:attribute name="readOnly" default="false" />
	<composite:attribute name="container" />

	<composite:editableValueHolder name="articulo" targets="articulo"></composite:editableValueHolder>
</composite:interface>

<composite:implementation>
	<!-- PEDIDO VENTA -->
	<div id="#{cc.id}">
		<p:panelGrid id="#{cc.attrs.container}">
			<p:row>
				<!-- PEDIDO NUMERO -->
				<p:column>
					<h:outputLabel for="pedidoNumero" value="Pedido" />
				</p:column>
				<p:column>
					<p:inputText id="pedidoNumero" value="#{cc.attrs.pedido.id}" disabled="true" />
				</p:column>
				<p:column>
				</p:column>
				<!-- CLIENTE -->
				<p:column>
					<h:outputLabel for="cliente" value="Cliente" />
				</p:column>
				<p:column>
					<p:inputText id="cliente" readonly="true" value="#{cc.attrs.pedido.clienteBean.nombre}"
						required="#{!cc.attrs.readOnly}" label="Cliente" />
					<h:inputHidden id="cliente_h" value="#{cc.attrs.pedido.clienteBean.nombre}"
						required="#{!cc.attrs.readOnly}" />
					<p:commandButton type="button" title="Buscar Cliente" styleClass="searchButton"
						icon="ui-icon-search" onclick="clienteDialog.show()" rendered="#{!cc.attrs.readOnly}"
						update="clienteDialog" />
				</p:column>
				<p:column>
					<p:message showDetail="false" id="cliente_message" for="cliente_h" />
				</p:column>
			</p:row>
		</p:panelGrid>
	</div>
	<p:dialog id="clienteDialogID" widgetVar="clienteDialog" modal="true" header="Eliga un cliente"
		showEffect="clip" hideEffect="clip">
		<p:ajax event="close" listener="#{ordenVtaMB.getResultCliente}"
			update=":#{cc.attrs.parentId}:#{cc.id}:cliente :#{cc.attrs.parentId}:#{cc.id}:cliente_h" />
		<common:clientes oncomplete="clienteDialog.hide();" />
	</p:dialog>
</composite:implementation>

</html>